package com.zb.hms.data.hms.user.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.zb.hms.data.hms.user.dao.inter.UserDaoInter;
import com.zb.hms.data.hms.user.entity.User;
import com.zb.hms.data.hms.user.service.inter.UserServiceInter;
@Service
public class UserServiceImpl implements UserServiceInter {
	@Resource
  private UserDaoInter userDao;
	@Override
	@Transactional
	public void saveUser(User user) {
		// TODO Auto-generated method stub
		userDao.save(user);
	}
	@Override
	@Transactional
	public boolean existsEamil(String email) {
		// TODO Auto-generated method stub
		Map<String,Object> params=new HashMap<>();
		params.put("email", email);
		if(userDao.get("from User where email=:email", params).size()<1)
			return true;
		else
			return false;
	}
	

}
